$(document).ready(function () {
    var params = {};
    params.url = obj[myKey] + '/getGridData.do';
    params.toolbar = [
        {
            iconCls: 'icon-edit',
            text: '编辑',
            handler: function () {
                function callEdit(id) {
                    var params = {};
                    params.url = obj[myKey] + '/edit.do?id=' + id;
                    params.datatype = "html";
                    params.dealAjaxBack = dealAjaxBack;
                    ajax(params);
                    function dealAjaxBack(data) {
                        toInput();
                        $('#' + obj[myKey] + 'sideDiv').html(data);
                    };
                }

                doEdit(callEdit);
            }
        },
        '-',
        {
            iconCls: 'icon-remove',
            text: '删除',
            handler: function () {
                doDelete();
            }
        },
        '-',
        {
            iconCls: 'icon-add',
            text: '添加',
            handler: function () {
                var params = {};
                params.url = obj[myKey] + '/add.do';
                params.datatype = "html";
                params.dealAjaxBack = dealAjaxBack;
                ajax(params);
                function dealAjaxBack(data) {
                    toInput();
                    $('#' + obj[myKey] + 'sideDiv').html(data);
                };
            }
        }
    ];
    params.columns = [
        [
            {field: 'ck', checkbox: true},
            {field: "id", title: "id", width: fillsize(1 / 6)},
            {field: "name", title: "name", width: fillsize(1 / 6)},
            {field: "borthDate", title: "borthDate", width: fillsize(1 / 6)},
            {field: "age", title: "age", width: fillsize(1 / 6)},
            {field: "height", title: "height", width: fillsize(1 / 6)},
            {field: "clazz.name", title: "clazz", width: fillsize(1 / 6)}

        ]
    ];
    initGrid(params);
    initSearchBoxDiv();
    function initSearchBoxDiv() {
        $('#' + obj[myKey] + 'searchBox').searchbox({
            searcher: function (value, name) {
                var params = {};
                params.searchType = 'simple_search';
                params.searchProperty = name;
                params.searchValue = value;
                searchSimpleGrid(params);
            },
            menu: '#' + obj[myKey] + 'searchProperty',
            prompt: 'Please Input Value'
        });
        $('#' + obj[myKey] + 'advanceSearchPanel').hide(100);
        $('#' + obj[myKey] + 'advanceSearch').click(function () {
            $('#' + obj[myKey] + 'advanceSearchPanel').show(100);
            $('#' + obj[myKey] + 'simpleSearchPanel').hide(100);
        });
    }


});